import { constantRoutes, asyncRoutes } from '@/router'
const state = {
  roter: constantRoutes || []
}
const mutations = {
  setroutes(state, otheroutes) {
    state.roter = [...constantRoutes, ...otheroutes]
  }
}
const actions = {
  filterRoutes(context, menus) {
    // console.log(menus)
    const otheroutes = asyncRoutes.filter((item) =>
      menus.includes(item.children[0].name)
    )
    context.commit('setroutes', otheroutes)
    return otheroutes
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
// {
//     if (menus.includes(item.children[0].name)) {
//       return true
//     } else {
//       return false
//     }
//   }
